package com.itheima.tlias84.mapper;

import com.itheima.tlias84.dto.SelectLogmsgDTO;
import com.itheima.tlias84.entity.Emp;
import com.itheima.tlias84.po.InsertLogmsgParam;
import com.itheima.tlias84.po.SelectLogmsgPageParam;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Mapper
public interface ReportMapper {
    @Select("SELECT COUNT(*) FROM emp WHERE gender = 1")
    int countMale();

    @Select("SELECT COUNT(*) FROM emp WHERE gender = 2")
    int countFemale();


    @Select("SELECT job , COUNT(id) as dataList  FROM emp GROUP BY job")
    List<Map<Integer,Integer>> countJobs();

    List<SelectLogmsgDTO> selectLogmsg(@Param("p")SelectLogmsgPageParam param);

    int insertLogmsg(@Param("p") InsertLogmsgParam param);
}
